/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Admin.java
 *
 * Created on 04-04-2012, 21:33:18
 */
package GUI;

import POJO.NhanVienPoJo;
import javax.swing.JOptionPane;

/**
 *
 * @author tran quoc thinh
 */
public class Admin extends javax.swing.JFrame {

    /** Creates new form Admin */
    public Admin() {
        initComponents();
        jlbThongBao.setText("Xin Chào " + nv.getTenNV());
    }

    NhanVienPoJo nv = new NhanVienPoJo();
    
    public Admin(NhanVienPoJo nv1)
    {
        nv = new NhanVienPoJo(nv1);
        initComponents();
        jlbThongBao.setText("Xin Chào " + nv.getTenNV());
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jToolBar1 = new javax.swing.JToolBar();
        jlbThongBao = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jmnDangXuat = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Admin");
        setBackground(new java.awt.Color(153, 153, 153));

        jDesktopPane1.setBackground(new java.awt.Color(204, 204, 204));
        getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

        jToolBar1.setRollover(true);
        jToolBar1.setPreferredSize(new java.awt.Dimension(20, 20));

        jlbThongBao.setText("Bạn Chưa Đăng Nhập");
        jToolBar1.add(jlbThongBao);

        getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_END);

        jMenu1.setText(" Nhân viên    ");
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu1MouseClicked(evt);
            }
        });
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Xuất chiếu      ");
        jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu2MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu2);

        jMenu3.setText("Quản lý ghế ngồi     ");
        jMenu3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu3MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu3);

        jMenu4.setText("Phim     ");
        jMenu4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu4MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu4);

        jmnDangXuat.setText("Đăng Xuất");
        jmnDangXuat.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnDangXuatMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnDangXuat);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
// TODO add your handling code here:
//    Ad_NhanVienInternalFrame frnNhanVien = new Ad_NhanVienInternalFrame();
//    frnNhanVien.setVisible(true);
//    this.jDesktopPane1.add(frnNhanVien);
}//GEN-LAST:event_jMenu1ActionPerformed

private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
// TODO add your handling code here:
    this.jDesktopPane1.removeAll();
    Ad_NhanVienInternalFrame frnNhanVien = new Ad_NhanVienInternalFrame();
    frnNhanVien.setVisible(true);
    this.jDesktopPane1.add(frnNhanVien);
}//GEN-LAST:event_jMenu1MouseClicked

private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu2MouseClicked
// TODO add your handling code here:
    this.jDesktopPane1.removeAll();
    Ad_XuatChieuInternalFrame frmXuatChieu = new Ad_XuatChieuInternalFrame();
    frmXuatChieu.setVisible(true);
    this.jDesktopPane1.add(frmXuatChieu);
    
}//GEN-LAST:event_jMenu2MouseClicked

private void jMenu3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu3MouseClicked
// TODO add your handling code here:
    this.jDesktopPane1.removeAll();
    Ad_RapInternalFrame frmRap = new Ad_RapInternalFrame();
    frmRap.setVisible(true);
    this.jDesktopPane1.add(frmRap);
}//GEN-LAST:event_jMenu3MouseClicked

private void jMenu4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu4MouseClicked
// TODO add your handling code here:
//    this.jDesktopPane1.remove(jMenu1);
//    this.jDesktopPane1.remove(jMenu2);
//    this.jDesktopPane1.remove(jMenu3);
    this.jDesktopPane1.removeAll();
    Ad_PhimInternalFrame frmPhim = new Ad_PhimInternalFrame();
    frmPhim.setVisible(true);
    this.jDesktopPane1.add(frmPhim);
}//GEN-LAST:event_jMenu4MouseClicked

private void jmnDangXuatMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnDangXuatMouseClicked
// TODO add your handling code here:
    int kq = JOptionPane.showConfirmDialog(this, "Bạn Có Muốn Đăng Xuất Không?", "Đăng Xuất", JOptionPane.YES_NO_OPTION);
    if(kq == JOptionPane.YES_OPTION)
    {
        this.dispose();
        DangNhap frm = new DangNhap();
        frm.setVisible(true);
        this.jDesktopPane1.add(frm);   
    }
    
}//GEN-LAST:event_jmnDangXuatMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Admin().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel jlbThongBao;
    private javax.swing.JMenu jmnDangXuat;
    // End of variables declaration//GEN-END:variables
}
